// 引入mongoose接口
const mongoose = require("mongoose");

require("../db/index");

mongoose.connect("mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/chenpeng",
    {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        auth: { authSource: "admin" }
    },
    async () => {
        const seatsModel = mongoose.model("seats");
        const seatsArr = [];
        for (let i = 1; i <= 9; i++) {
            for (let j = 1; j <= 9; j++) {
                seatsArr.push({
                    displayName: `${i}排${j}列`,
                    theaterId: "61526cb951266a45dc2cb987"
                })
            }
        }
        const data = await seatsModel.create(seatsArr)
        console.log(data)
    }
);